<template>
  <div style="height: 33px">
    <el-row :gutter="20" type="flex">
      <el-col :span="18">
        <el-button
          type="primary"
          size="small"
          icon="el-icon-s-claim"
          @click="handleBatchAudit"
          plain
          :disabled="multipleSelection.length == 0 || auditType == 2"
          >批量审核</el-button
        >
      </el-col>
    </el-row>
  </div>
</template>
<script>
import { throttle } from 'lodash'
export default {
  data() {
    return {
      multipleSelection: [],
      listQueryIn: {
        title: '',
      },
    }
  },
  props: ['auditType'],
  watch: {
    curJournal: {
      handler() {
        this.multipleSelection = []
      },
    },
  },
  mounted() {
    this.$bus.$on('deleteBatchNewsContents', (v) => {
      this.multipleSelection = v
    })
  },
  beforeDestroy() {
    this.$bus.$off('deleteBatchNewsContents')
  },
  methods: {
    handleInput: throttle(function () {
      this.refreshList()
    }, 2000),
    refreshList() {
      this.$bus.$emit('refreshNewsContentsList', this.listQueryIn)
    },

    //批量删除
    handleBatchAudit() {
      if (!this.multipleSelection.length) {
        this.warnMsg('请选择要审核的文章')
        return
      }
      this.$bus.$emit('showDialogAudit', this.multipleSelection)
    },
  },
}
</script>